﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="PanelInput.ascx.cs" Inherits="admin_webparts_Plug_ins_Panel_PanelInput" %>

<%@ Import Namespace="NTTHAO.Common.BL" %>
<%@ Import Namespace="NTTHAO.Web.BL.Panel" %>
<%@ Import Namespace="NTTHAO.CommonWeb" %>

<script type="text/javascript">
NTTHAO.namespace('page');

NTTHAO.page.langText = [];
NTTHAO.page.langText['BLANK_HEADER'] = '<%=LanguageUtility.GetLanguageText("BLANK_HEADER", Session)%>';
NTTHAO.page.langText['INVALID_IMAGE_FILE'] = '<%=LanguageUtility.GetLanguageText("INVALID_IMAGE_FILE", Session)%>';

function doSubmit() {
    var txtTitle = document.getElementById("<%=this.txtTitle.ClientID %>");
    var fuImage = document.getElementById("<%=this.fuImage.ClientID %>");
    var imageEx = "<%=Constant.IMAGE_FILE_EXTENTIONS %>".split(" ");

    var errorMessage = "";

    errorMessage = CheckFieldString("noblank", txtTitle, NTTHAO.page.langText['BLANK_HEADER']);
    if(errorMessage != "")
    {
        alert(errorMessage);
        txtTitle.select();
        txtTitle.focus();
        return false;
    }
    
    <%if (this._Detail == null)
      { %>
    /*
    errorMessage = CheckFieldString("noblank", fuImage, NTTHAO.page.langText['INVALID_IMAGE_FILE']);
    if(errorMessage != "")
    {
        alert(errorMessage);
        fuImage.focus();
        return false;
    }
    */
    <%} %>
    
    var imgFileName = Trim(fuImage.value);
    if (imgFileName != '' && !checkFileType(imgFileName, imageEx)) {
        alert(NTTHAO.page.langText['INVALID_IMAGE_FILE']);
        fuImage.focus();
        return false;
    }
    
    return true;
}
</script>
<style type="text/css">
    #spCancel1, #spSave, #spCancel2, #spSave2 {font-size:1.1em; font-weight: bold; }
    #spCancel1 button, #spSave button, #spCancel2 button, #spSave2 button { font-family: Verdana,Arial,Helvetica,sans-serif; font-weight: bold; }
</style>
<div class="tip">
	<h1><%=LanguageUtility.GetLanguageText("IMAGE_FILE_INPUT", Session)%></h1>
</div>
<form id="frmInput" runat="server" onsubmit="return doSubmit();">
<p style="text-align: left;">
    <span id="spSave" class="yui-button yui-link-button yuibtn yuibtn-icon btnsave"><span class="first-child"><asp:Button ID="btnSave" runat="server" OnClick="btnSave_Click" Text="Save" /></span></span>
    <span id="spCancel1" class="yui-button yui-link-button yuibtn yuibtn-icon btncancel"><span class="first-child"><a href="?type=<%=Request.QueryString["type"] %>&name=<%=Request.QueryString["name"] %>&action=viewgroup&groupid=<%=Request.QueryString["groupid"] %>"><%=LanguageUtility.GetLanguageText("CANCEL", Session)%></a></span></span>
    <script type="text/javascript">
        YAHOO.util.Event.onContentReady("spSave", function () {
            var spSave = new YAHOO.widget.Button("spSave");
        });
        YAHOO.util.Event.onContentReady("spCancel1", function () {
            var spCancel1 = new YAHOO.widget.Button("spCancel1");
        });
    </script>
</p>
<table cellspacing="0" cellpadding="3" border="1" class="grid" style="margin: 10px auto;">
    <tr class="even">
        <td align="right"><%=LanguageUtility.GetLanguageText("TITLE", Session)%>:</td>
        <td><asp:TextBox ID="txtTitle" runat="server" Width="400px"></asp:TextBox></td>
    </tr>
    <tr class="odd">
        <td align="right">
            <%=LanguageUtility.GetLanguageText("IMAGE", Session)%>:
        </td>
        <td>
            <asp:FileUpload ID="fuImage" runat="server"/>
            &nbsp;<div style="color: mediumblue; background-color: moccasin; padding: 3px 10px 3px 10px; display: inline;"><%=Constant.IMAGE_FILE_EXTENTIONS + " " + Constant.FLASH_FILE_EXTENTIONS%></div>
        </td>
    </tr>
    <%if (this._Detail != null)
      { %>
    <tr class="odd">
        <td align="right"><%=LanguageUtility.GetLanguageText("CURRENT_IMAGE", Session)%>:</td>
        <td>
            <img alt="" src="../<%=this._Group.ImagePath + this._Detail.FileName %>" style="max-width: 200px; max-height: 150px;" />
        </td>
    </tr>
    <%} %>
    <tr class="even">
        <td align="right">
            <%=LanguageUtility.GetLanguageText("LINK", Session)%>:
        </td>
        <td>
            http:// <asp:TextBox ID="txtURL" runat="server" Width="362px" Text="#"></asp:TextBox>
        </td>
    </tr>
    <tr class="odd">
        <td align="right"><%=LanguageUtility.GetLanguageText("ACTIVE", Session)%>:</td>
        <td>
            <asp:CheckBox ID="chkActive" runat="server" Text="Active" Checked="true" /></td>
    </tr>
</table>
<p style="text-align: left;">
    <span id="spSave2" class="yui-button yui-link-button yuibtn yuibtn-icon btnsave"><span class="first-child"><asp:Button ID="btnSave2" runat="server" OnClick="btnSave_Click" Text="Save" /></span></span>
    <span id="spCancel2" class="yui-button yui-link-button yuibtn yuibtn-icon btncancel"><span class="first-child"><a href="?type=<%=Request.QueryString["type"] %>&name=<%=Request.QueryString["name"] %>&action=viewgroup&groupid=<%=Request.QueryString["groupid"] %>"><%=LanguageUtility.GetLanguageText("CANCEL", Session)%></a></span></span>
    <script type="text/javascript">
        YAHOO.util.Event.onContentReady("spSave2", function () {
            var spSave2 = new YAHOO.widget.Button("spSave2");
        });
        YAHOO.util.Event.onContentReady("spCancel2", function () {
            var spCancel2 = new YAHOO.widget.Button("spCancel2");
        });
    </script>
</p>
</form>
<script type="text/javascript">

YAHOO.util.Event.onDOMReady(function() {
    document.getElementById("<%=txtTitle.ClientID %>").focus();
});
</script>